﻿using Dotnet.TopApi;
using Dotnet.TopApi.Request;
using My.Dotnet.Net;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.Util;

namespace Dotnet.Sui
{
    //POST https://www.sui.com/tally/income.rmi 支出记账
    public class TallyIncomeRmiRequest : SuiRequest, ITopRequest<TallyIncomeRmiResponse>
    {
        private string _id = "0";
        private string _category = "64200973810";//分类
        private string _store = "";
        private string _time = DateTime.Now.ToString("yyyy-MM-dd HH:mm");//时间
        private string _project = "";
        private string _member = "";
        private string _memo = "自支";//备注
        private string _url = "";
        private string _out_account = "";
        private string _in_account = "";
        private string _debt_account = "";
        private string _account = "17273911133"; //账号
        private string _price = "10";
        private string _price2 = "";
        public string Id { get => _id; set => _id = value; }
        public string Category { get => _category; set => _category = value; }
        public string Store { get => _store; set => _store = value; }
        public string Time { get => _time; set => _time = value; }
        public string Project { get => _project; set => _project = value; }
        public string Member { get => _member; set => _member = value; }
        public string Memo { get => _memo; set => _memo = value; }
        public string Url { get => _url; set => _url = value; }
        public string Out_account { get => _out_account; set => _out_account = value; }
        public string In_account { get => _in_account; set => _in_account = value; }
        public string Debt_account { get => _debt_account; set => _debt_account = value; }
        public string Account { get => _account; set => _account = value; }
        public string Price { get => _price; set => _price = value; }
        public string Price2 { get => _price2; set => _price2 = value; }
        public string GetApiName()
        {
            return "tally/income.rmi";
        }

        public IDictionary<string, string> GetParameters()
        {
            TopDictionary dict = base.GetParameters1() as TopDictionary;
            dict.AddHeadersContentType("application/x-www-form-urlencoded;charset=UTF-8");
            dict.Add("id", _id);
            dict.Add("category", _category);
            dict.Add("store", _store);
            dict.Add("time", _time);
            dict.Add("project", _project);
            dict.Add("member", _member);
            dict.Add("memo", _memo);
            dict.Add("url", _url);
            dict.Add("out_account", _out_account);
            dict.Add("in_account", _in_account);
            dict.Add("debt_account", _debt_account);
            dict.Add("account", _account);
            dict.Add("price", _price);
            dict.Add("price2", _price2);
            return dict;
        }

        public void Validate()
        {
            //throw new NotImplementedException();
            //category   
            //RequestValidator
            Dotnet.TopApi.Util.RequestValidator.ValidateRequired("category", _category);
            Dotnet.TopApi.Util.RequestValidator.ValidateRequired("account", _account);
        }
    }

    public class TallyIncomeRmiResponse : SuiRespose
    {

    }
}
